package com.example.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.example.model.Song;

@Mapper
public interface SongMapper {

	@Options(useGeneratedKeys = true, keyProperty = "id")
	@Insert("insert into song(name,singer,createtime,updatetime) values(#{name},#{singer},#{createtime},#{updatetime})")
	int save(Song song);

	@Delete("delete from song where id = #{id}")
	int delete(Integer id);

	@Update("update song set name = #{name},singer= #{singer},updatetime = #{updatetime} where id = #{id}")
	int updatSongById(Song song);

	@Select("select * from song where id = #{id}")
	Song selectSongById(Integer id);

	@Select("select * from song")
	List<Song> findAll();

}
